Check instantly whether a phrase reads the same backwards, ignoring spaces and punctuation, and find the longest palindrome inside it.
Check whether a phrase reads the same forwards and backwards
Checks whether a sentence reads the same forwards and backwards (a palindrome) and finds the longest palindromic stretch hidden inside it. The result updates with every keystroke, which makes it easy to build a palindrome one letter at a time. Use it for wordplay and language puzzles, classroom material, or checking answers to coding exercises.
The sentence is cleaned first: English letters are lowercased, and only letters (in any script) and digits are kept, while spaces, punctuation, symbols and emoji are removed. If the cleaned string is identical when reversed, it is a palindrome. The longest palindrome is found by center expansion: each position in the cleaned string is used as a center and widened outward while the characters on both sides match, checking both odd and even lengths. For example, 'Was it a car or a cat I saw?' cleans to 'wasitacaroracatisaw', which reverses to itself, so it is a palindrome. 'My racecar is red' cleans to 'myracecarisred' and is not a palindrome, but the longest-palindrome box shows 'racecar'.
'A man, a plan, a canal: Panama', 'Never odd or even', 'Was it a car or a cat I saw?' and single words like 'racecar' and 'level'. All read the same once spaces and punctuation are removed.
No. Everything is lowercased before comparing, so 'Madam' and 'madam' give the same result.
By center expansion: every character and every gap between characters is tried as a center and widened while both sides match. If several palindromes share the longest length, the first one is shown.
No. All checking is done in your browser and nothing is stored.
Posts · 0
No posts yet.